﻿#region License
// (c) Intergen.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using TextGlow.Control.Utilities;

namespace TextGlow.Control.Model
{
  public class LineBreak : RunContent
  {
    public const string LocalName = "br";

    private LineBreakType _type;
    private string _clear;

    public string Clear
    {
      get { return _clear; }
      set { _clear = value; }
    }

    public LineBreakType Type
    {
      get { return _type; }
      set { _type = value; }
    }

    public LineBreak(Run parent, XElement element)
      : base(parent, element)
    {
      _clear = XmlUtils.GetValue(element, "clear");
      _type = XmlUtils.GetValue<LineBreakType>(element, "type") ?? LineBreakType.Line;
    }

    public override RunContentType ContentType
    {
      get { return RunContentType.LineBreak; }
    }

    public override string ToString()
    {
      return "{br}";
    }
  }
}